package books.to.africa

import java.util.Date;

class TeacherRegister extends User{
	String firstName
	String lastName
	String street
	String town
	String region
	String country
	String schoolName
//	byte[] teacherPicture// teacherPicture
//	byte[ ] schoolPicture
	String gradeLevel
	String telephoneNumber
	String email
	Date dateCreated = new Date()
	
	static hasMany = [ bookRequests:BookRequest ]
	
    static constraints = {
		firstName(blank: false)
		lastName(blank: false)
		street(blank: false)
		town(blank: false)
		region(blank: false)
		country(blank: false, inList: ["Algeria", "Angola", "Benin", "Botswana", "Burkina Faso", "Burundi",	"Cameroon",	"Cape Verde", "Central African Rep", "Chad", "Comoros", "Cote d'Ivoire", "Democratic Republic of the Congo", "Republic of the Congo", "Djibouti", "Egypt", "Equatorial Guinea", "Eritrea", "Ethiopia", "Gabon", "Gambia", "Ghana", "Guinea", "Guinea-Bissau", "Kenya", "Lesotho", "Liberia", "Libya", "Madagascar",	"Malawi", "Mali", "Mauritania", "Mauritius", "Morocco", "Mozambique", "Namibia", "Niger", "Nigeria", "Rwanda", "Sao Tome and Principe", "Senegal", "Seychelles", "Sierra Leone", "Somalia",	"South Africa",	"South Sudan", "Sudan", "Swaziland", "Tanzania", "Togo", "Tunisia",	"Uganda", "Zambia",	"Zimbabwe"])
		schoolName(blank: false)
		gradeLevel(blank: false, inList: ["K", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"])
		telephoneNumber(matches: /((\(\d{3}\))|(\d{3}-))\d{3}-\d{4}/)
	//	userName(blank: false, size: 2..20, unique: true)
		email(blank: false, email: true, unique: true)
	//	password(blank: false, size: 6..8, validator: {password, register -> return password != register.userName})
	//	passwordAgain(blank: false, validator: {passwordAgain, register -> return passwordAgain == register.password})
	    }
}
